<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/>
	<th:block th:include="include :: header('新增模板')" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-template-add">
		<input id="treeId" name="categoryId" type="hidden" th:value="${category.categoryId}"   />
		<div class="form-group">
			<label class="col-sm-3 control-label">分类名称：</label>
			<div class="col-sm-8">
				<div class="input-group">
					<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${category.categoryName}">
					<span class="input-group-addon"></span>
				</div>
			</div>
		</div>
		
		<div class="form-group">
			<label class="col-sm-3 control-label is-required">是否生效：</label>
			<div class="col-sm-8">
				<div class="radio-box">
					<input type="radio" name="status" value=1 checked="checked">
					<label>是</label>
					<input type="radio" name="status" value=0>
					<label>否</label>
				</div>
			</div>
		</div>

	</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script type="text/javascript">

	var prefix = ctx + "templateController";



	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/addSave", $('#form-template-add').serialize());
		}
	}

	function doSubmit(index, layero){
		var body = layer.getChildFrame('body', index);
		$("#treeId").val(body.find('#treeId').val());
		$("#treeName").val(body.find('#treeName').val());
		layer.close(index);
	}

	/*部门管理-新增-选择父部门树*/
	function selectDeptTree() {
		var options = {
			title: '部门选择',
			width: "380",
			url: "/categoryController/selectDeptTree/" + $("#treeId").val(),
			expandLevel: 1,
			callBack: doSubmit
		};
		$.modal.openOptions(options);
	}

</script>
</body>
</html>
